package com.suwish.test;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import com.suwish.pc.startup.Launcher;
import com.suwish.pc.ui.component.tab.UITabPanel;
import com.suwish.pc.ui.component.tab.UITabbedPanel;

public class TabDemo extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public TabDemo()throws Exception{
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		initUI();
	}
	
	private void initUI()throws Exception{
		new Launcher();
		UITabbedPanel panel = new UITabbedPanel();
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(panel, BorderLayout.CENTER);
		JMenuBar bar = new JMenuBar();
		
		setJMenuBar(bar);
		JMenu menu = new JMenu("File");
		bar.add(menu);
		menu.add(new JMenuItem("Open"));
//		UITabPanel tab = 
		//tab.setBackground(Color.GREEN);
		panel.addContainerComponent(getTabPanel(Color.BLACK));
		panel.addContainerComponent(getTabPanel(Color.GREEN));
		panel.addContainerComponent(getTabPanel(Color.BLUE));
		panel.addContainerComponent(getTabPanel(Color.YELLOW));
	}
	
	
	private UITabPanel getTabPanel(Color clor){
		UITabPanel tab = new UITabPanel(){

			/**
			 * 
			 */
			private static final long serialVersionUID = 1L;

			@Override
			public String getName() {
				// TODO Auto-generated method stub
				return "getName";
			}

			@Override
			public String getTip() {
				// TODO Auto-generated method stub
				return "getTip";
			}

			@Override
			public String getTitle() {
				return "getTitle";
			}

			@Override
			public Icon getIcon() {
				return null;
			}

			@Override
			public TabType getTabType() {
				return null;
			}

			@Override
			public boolean close() {
				// TODO Auto-generated method stub
				return true;
			}
			
		};
		tab.setBackground(clor);
		return tab;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args)throws Exception {
		new TabDemo().setVisible(true);

	}

}
